home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / emstools.arc / EMMLIB.ARC / EMM28_D.ASM < prev    next >
Assembly Source File  |  1990-02-04  |  6KB  |  106 lines

  1. ;-----------------------------------------------------------------------------;
  2. ;      MODULE NAME:   EMM28_D.ASM                                             ;
  3. ;                                                                             ;
  4. ; OS FUNCTION NAME:   alloc_alt_reg_set                                       ;
  5. ;                                                                             ;
  6. ;      DESCRIPTION:   This function gets the number of an alternate map       ;
  7. ;                     register set for an operating system if an alternate    ;
  8. ;                     map register set is currently available for use.  If    ;
  9. ;                     the hardware does not support alternate map register    ;
  10. ;                     sets, an alternate map register set number of zero will ;
  11. ;                     be returned.                                            ;
  12. ;                                                                             ;
  13. ;                     The alternate map register set allocated may be         ;
  14. ;                     referred to by this number when using the               ;
  15. ;                     get_alt_reg_set or set_alt_reg_set functions.  The      ;
  16. ;                     operating system can use these functions to switch map  ;
  17. ;                     contexts very rapidly on expanded memory hardware with  ;
  18. ;                     alternate map register sets.  This function copies the  ;
  19. ;                     currently active alternate map register sets contents   ;
  20. ;                     into the newly allocated alternate map register set's   ;
  21. ;                     mapping registers.  This is done so that when the OS/E  ;
  22. ;                     performs a set_alt_reg_set function the memory mapped   ;
  23. ;                     before the allocation of the new alternate map will be  ;
  24. ;                     available for reading and writing.  This function does  ;
  25. ;                     not actually change the alternate map register set in   ;
  26. ;                     use, but in addition to allocating a new alternate map  ;
  27. ;                     register set, it prepares the new alternate map         ;
  28. ;                     register set for a subsequent set_alt_reg_set function. ;
  29. ;                                                                             ;
  30. ;           PASSED:   &alt_reg_set:                                           ;
  31. ;                        is a far pointer to the alternate register set       ;
  32. ;                        which will be allocated to the operating system.     ;
  33. ;                                                                             ;
  34. ;         RETURNED:   status:                                                 ;
  35. ;                        is the status EMM returns from the call.  All other  ;
  36. ;                        returned results are valid only if the status        ;
  37. ;                        returned is zero.  Otherwise they are undefined.     ;
  38. ;                                                                             ;
  39. ;                     alt_reg_set:                                            ;
  40. ;                        is the number of an alternate map register set.  If  ;
  41. ;                        there are no alternate map register sets supported   ;
  42. ;                        by the hardware, a zero will be returned.  In this   ;
  43. ;                        case, the get_alt_reg_set function should be invoked ;
  44. ;                        in order to obtain a pointer to a mapping hardware   ;
  45. ;                        context save area.  The OS/E must supply this save   ;
  46. ;                        area.  The save area is necessary because the        ;
  47. ;                        hardware doesn't support alternate map register      ;
  48. ;                        sets.                                                ;
  49. ;                                                                             ;
  50. ; C USE CONVENTION:   unsigned int status;                                    ;
  51. ;                     unsigned int alt_reg_set;                               ;
  52. ;                                                                             ;
  53. ;                     status = alloc_alt_reg_set (&alt_reg_set);              ;
  54. ;-----------------------------------------------------------------------------;
  55. .XLIST
  56. PAGE    60,132
  57.  
  58. IFDEF SMALL
  59.    .MODEL SMALL, C
  60. ENDIF
  61. IFDEF MEDIUM
  62.    .MODEL MEDIUM, C
  63. ENDIF
  64. IFDEF LARGE
  65.    .MODEL LARGE, C
  66. ENDIF
  67. IFDEF COMPACT
  68.    .MODEL COMPACT, C
  69. ENDIF
  70. IFDEF HUGE
  71.    .MODEL HUGE, C
  72. ENDIF
  73.  
  74. INCLUDE emmlib.equ
  75. INCLUDE emmlib.str
  76. INCLUDE emmlib.mac
  77. .LIST
  78. .CODE
  79.  
  80. alloc_alt_reg_set    PROC                                                  \
  81.             ptr_alt_reg_set:FAR PTR WORD
  82.  
  83.     ;---------------------------------------------------------------------;
  84.     ;   do;                                                               ;
  85.     ;   .   allocate an alternate map register set from EMM;              ;
  86.     ;---------------------------------------------------------------------;
  87.     MOVE        AX, allocate_alt_map_regs_fcn
  88.     INT         EMM_int
  89.  
  90.     ;---------------------------------------------------------------------;
  91.     ;   .   pass the alternate map register set back to the caller;       ;
  92.     ;---------------------------------------------------------------------;
  93.     MOVE        DH:DL, 0:BL
  94.     MOVE        ES:BX, ptr_alt_reg_set
  95.     MOVE        ES:[BX], DX
  96.  
  97.     ;---------------------------------------------------------------------;
  98.     ;   .   return (EMM status);                                          ;
  99.     ;   end;                                                              ;
  100.     ;---------------------------------------------------------------------;
  101.     RET_EMM_STAT    AH
  102.  
  103. alloc_alt_reg_set        ENDP
  104.  
  105. END
  106.